package com.kingsoft.miot.bridge.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kingsoft.miot.bridge.dao.DeviceInfoDao;
import com.kingsoft.miot.bridge.exception.CommonException;
import com.kingsoft.miot.bridge.pojo.ServiceAuth;
import com.kingsoft.miot.bridge.pojo.device.DeviceInfo;
import com.kingsoft.miot.bridge.pojo.device.DeviceUris;
import com.kingsoft.miot.bridge.service.BaseService;
import com.kingsoft.miot.bridge.service.DeviceService;

/**
 * 设备信息服务
 * 
 * @author melody
 *
 */
@Service
public class DeviceServiceImpl extends BaseServiceImpl implements DeviceService, BaseService {

	// 服务商提供参数
	@Autowired
	private ServiceAuth serviceAuth;

	// 设备接口请求URI
	@Autowired
	private DeviceUris deviceUris;

	@Autowired
	private DeviceInfoDao deviceInfoDao;

	@Override
	public List<DeviceInfo> getListByHouseId(int hotel_id) {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * 返回存在control unit id下的所有设备
	 */
	@Override
	public List<DeviceInfo> getListByControlUnitId(long control_unit_id) {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * 根据control unit id 获取所有相关的设备
	 */
	@Override
	public List<DeviceInfo> getListByControlUnitId(List<Integer> control_unit_id_list) {

		try {
			// 1. 多次请求获取所有的设备信息
			String devicesUri = deviceUris.getDevicesUri();
			for (int i = 0; i < control_unit_id_list.size(); i++) {

			}

		} catch (Exception e) {
			throw new CommonException(e);
		}
		// 1.获取所有的设备信息

		return null;
	}

	@Override
	public List<DeviceInfo> getListByHotelIdAndHOuseId(String hotel_id, String house_id) {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * n 请求设备信息
	 * 
	 * @param control_unit_id
	 * @return
	 */
//	private String reqForDeviceInfoList(int control_unit_id) {
//		createParams(serviceAuth.getGroupId(), serviceAuth., privateKey, method, uri, nonce, data)
//	}

}
